import time
from threading import Thread


# def task(name):
#     print(f"{name}任务启动", end="\n")
#     time.sleep(3)
#     print(f"{name}任务die", end="\n")
#
#
# t = Thread(target=task, args=('李白',))
#
# t.start()
# print("主线程----", end="\n")

class MyPro(Thread):
    # 构造函数
    def __init__(self, name):
        super().__init__()
        self.name = name

    # 重写进程核心代码
    def run(self):
        print(f"{self.name}开始运行...", end="\n")
        time.sleep(3)
        print(f'{self.name}运行结束', end="\n")


if __name__ == '__main__':
    p = MyPro('里奈')
    p.start()
    print("运行主线程", end="\n")
